{% extends 'base.html' %}

{% block breadcrumb_current %}
    超级管理员 > 县区管理
{% endblock %}

{% block content %}
    {% if messages %}
        {% for message in messages %}
            <div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
                {{ message }}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
        {% endfor %}
    {% endif %}
    
    <div class="bg-light p-3 shadow-sm">
        <h5 style="color: #417690;">
            部门或县区管理
            <a href="{% url 'navigation' %}" class="btn btn-secondary btn-sm float-end" style="margin-left: 15px;">返 回</a>
            <a href="{% url 'superdepartment_add' %}" class="btn btn-secondary btn-sm float-end">新增县区</a>
        </h5>
    </div>

    <div class="container mt-4">
        <table class="table table-hover" style="margin-top: 15px;">
            <thead>
                <tr>

                    <th>县区名称</th>
                    <th>所属地市</th>
                    <th>编辑</th>
                    <th>删除</th>
                </tr>
            </thead>
            <tbody>
                {% for department in departments %}
                <tr class="custom-row-color">

                    <td>{{ department.department }}</td>
                    <td>{{ department.company }}</td>
                    <td><a href="{% url 'feature_not_available' %}" class="text-info text-decoration-none">编辑</a></td>
                    <td><a href="{% url 'feature_not_available' %}" class="text-info text-decoration-none"  onclick="return confirm('确定要删除{{department.department}}吗？')">删除</a></td>
                </tr>
                {% empty %}
                <tr>
                    <td colspan="4" class="text-center">暂无县区数据</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock %}